import React, { Component } from 'react';
import ReactDom from "react-dom";

// 以下是自定义组件示例
class BasicComponent extends Component {
    constructor(props){
        super(props)
    }
    state = {
        code: "basic"
    }
    static defaultProps = {
        name: "基础组件～"
    }

    componentDidMount(){
        console.log("BasicComponent componentDidMount~",this.props.name);

        // this.renderChart();
    }
    handleClick (){

    }

    getOption(){
        let option = {
            xAxis: {
                type: 'category',
                data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
            },
            yAxis: {
                type: 'value'
            },
            series: [{
                data: [120, 200, 150, 80, 70, 110, 130],
                type: 'bar'
            }]
        };
        return option;
    }

    renderChart(){
        let option = this.getOption();
        this.myChart = echarts.init(ReactDom.findDOMNode(this));
        this.myChart.setOption(option);
    }
    render() {
        return (
            <div id="main" className={this.props.className} {...this.props.props}></div>
        );
    }
}

export default BasicComponent;